#include <iostream>
using namespace std;

int n;
int sum1 = 0, sum2 = 0;

int main()
{
    cin >> n;
    int a[n];
    int b[100020] = {0};
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        b[a[i]]++;
        sum1 += a[i];
    }
    bool flag1 = true;
    int temp = -1;
    for (int i = 0; i < 100020; i++)
    {
        if (b[i] != 0)
        {
            sum2 += i;
            flag1 = false;
        }
    }
    cout << sum1 << endl;
    if (flag1)
    {
        cout << sum1 << endl;
    }
    else
    {
        cout << sum2 << endl;
    }
    // system("pause");
}